﻿using System.Web.Mvc;
using System.Web.Routing;
using Journal.Common;
using Journal.Common.WebApplication;
using Journal.Front.App_Start;
using Ninject;
using NinjectManager;

namespace Journal.Front
{
    public class MvcApplication : BaseApplication
    {
        protected override void Application_Start()
        {
            base.Application_Start();
            AreaRegistration.RegisterAllAreas();
            /*WebApiConfig.Register(GlobalConfiguration.Configuration);*/
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new RazorViewEngine());
            // Create Ninject DI kernel
            IKernel kernel = Ioc.Container;
            // set dependency injection
            ControllerBuilder.Current.SetControllerFactory(new NinjectControllerFactory());
            NinjectWebCommon.SetupDependencyInjection(kernel);
            NinjectWebCommon.InstallPresentationService(kernel, "Journal.Front.Presentation");
        }
    }
}